<script type="text/javascript">
$(function () {
	var url = '${contextPath}script/oa/stock.js';
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
		}
	});
	
	$('.add-tag-input').keydown(function(e){
	  if (e.keyCode==13){
	 	 addTag_stock($(this));
	  }
	}); 
});
</script>

<style>
.my-filter-table {
	background: linear-gradient(to bottom, #F1FAFE 0%, #D9EDF7 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);
	border: 1px solid #9BE2F0;
	display: inline-block;
	margin-bottom: 5px;
	margin-left: 5px;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.my-filter-table a {
	color: #3A87AD;
    display: inline-block;
    margin: 0 4px;
}

.my-filter-table button {
	background: none repeat scroll 0 0 rgba(0, 0, 0, 0);
    border: 0 none;
    cursor: pointer;
    padding: 0;
    color: #000000;
    float: right;
    font-size: 20px;
    font-weight: bold;
    line-height: 20px;
    opacity: 0.4;
    text-shadow: 0 1px 0 #FFFFFF;
}

.add-tag-input {
	width:80px;
}
</style>

<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<div>
	<h3 class="title"><i class="fontello-icon-th-list-1"></i> 编辑领用信息</h3>
</div>
<div class="widget" >
	<div class="widget-content">
		<form id="editForm">
			<table style="width:80%;" class="table table-bordered animate2 fadeInUp">
				<thead>
					<tr>
						<th style="text-align:center;">商品名称<a href="javascript:;" onclick="javascript:addCon_stock();return false;" style="margin-left: 20px">[添加空白行]</a></th>
						<th style="text-align:center;width: 100px;">物品类别</th>
						<th style="text-align:center;">领用数量</th>
						<th>价格（现值:元）</td>
						<th>操作</th>
					</tr>
				</thead>
				<tbody id="ListBody">
				<#assign i = 0 />
					<tr class="rep">
						<td>
							<div class="input-append">
								<input class="gn" id="gn_${i}" name="itemList[${i}].gn" value="${(stock.gn)!''}" type="text" style="width: 120px;" readonly />
								<input id="gc_${i}" name="itemList[${i}].gc" value="${(stock.gc)!''}" type="hidden" />
								<button class="btn btn-xs btn-primary" pib="${i}" type="button" onclick="javascript:selectCon_stock($(this));return false;"><i class="icon-search"></i></button>
							</div>
						</td>
						<td><span id="sort_${i}" class="sort" style="width: 100px;"><#if stock?? && stock.sort == 1>消耗品<#elseif stock?? && stock.sort == 2>固定资产<#else>无</#if></span></td>
						<td><input id="cou_${i}" class="cou not-null" type="text" name="itemList[${i}].count" style="width: 100px;" <#if stock?? && stock.sort == 2>onMouseUp ="show_stock(${i});" readonly="readonly"<#else></#if>  onkeyup="javascript:checkNum_stock($(this));"/></td>
						<td><input class="p not-null" type="text" name="itemList[${i}].price" style="width: 100px;"/></td>
						<td style="text-align:center;">
							<a class="btn btn-danger" href="javascript:;" onclick="javascript:delete_stock($(this));return false;"><i class="icon-remove"></i></a>
						</td>
					</tr>
					<tr>
						<td id="biao_${i}" colspan="7" style="display:none;" j="0">
							<div>
								<font>请输入标签:</font><input i="${i}" type="text" class="add-tag-input" /><a href="javascript:;" class="btn btn-info" onclick="javascript: addTag_stock($(this).prev()); return false;" >确认</a>
							</div>
							<div id="div_biao_${i}" class="div">
							
							</div>
						</td>
					</tr>
				<#assign i = i + 1/>
				</tbody>
				<tr>
					<th colspan="2">领用人:&nbsp;
							<span class="btn-group ">
								<input  name="cname" id="cname" value="${(consuming.cname)!''}" class="form-control" type="text" readonly="readonly" style="width: 80px;"/>
								<input type="hidden" name="cc" id="cc" value="${(consuming.cc)!''}" class="form-control"/>
								<button class="btn btn-xs btn-primary" type="button" title="选择该用户所属机构" onclick="javascript: selectUser_stock();return false;"><i class="icon-search"></i></button>
							</span>
					</th>
					<th colspan="2">密码:&nbsp;<input id="pwd" name="pwd" type="password" style="width: 100px;"/></th>
					<td><a href="javascript:;" class="btn btn-info" onclick="javascript: affirm_stock(); return false;" >验证</a></td>
				</tr>
				<tr>
					<td colspan="7" style="text-align: center;">
						<a href="javascript:;" class="btn btn-info" onclick="javascript: saveCon_stock(); return false;"><i class="icon-save"></i>&nbsp;保&nbsp;&nbsp;存</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="javascript:;" class="btn btn-primary" onclick="javascript: sys_load_handle('stock');return false;"><i class="fontello-icon-block"></i>&nbsp;取&nbsp;&nbsp;消</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>

<input type="hidden" id="index" value="${i}" />
<table id="tempTable" style="display:none;">
	<tr class="rep">
		<td>
			<div class="input-append">
				<input class="gn" type="text" readonly style="width: 120px;"/>
				<button class="btn btn-xs btn-primary" type="button" onclick="javascript:selectCon_stock($(this));return false;"><i class="icon-search"></i></button>
				<input class="gc" type="hidden" />
			</div>
		</td>
		<td><span class="sort">无</span>
		<td><input class="cou not-null" type="text" onkeyup="javascript:checkNum_stock($(this));return false;" style="width: 100px;"/></td>
		<td><input class="p not-null" type="text" style="width: 100px;"/></td>
		<td style="text-align:center;"><a class="btn btn-danger" href="javascript:;" onclick="javascript:delete_stock($(this));return false;"><i class="icon-remove"></i></a></td>
	</tr>
	<tr><td colspan="7" style="display:none;" j="0">
		<div>
			<font>请输入标签:</font>
			<input i="${i}" type="text" class="add-tag-input"/><a href="javascript:;" class="btn btn-info" onclick="javascript: addTag_stock($(this).prev()); return false;" >确认</a>
		</div>
		<div id="div_biao_${i}" class="div">
						
		</div>
		</td></tr>
</table>
<div id="temp" style="display:none;">
	<div class="my-filter-table rep">
		<input class="t form-control" type="hidden" style="width:60px;"/>
		<a href="javascript:;"></a>&nbsp;&nbsp;&nbsp;&nbsp;
		<button type="button" class="del-tag" data-dismiss="alert">&times;</button>
	</div>
</div>
